Learning Parity with Noise (LPN)
Problem definition
Given:- A random binary matrix A ∈ ^(t × n)
- A secret binary vector s ∈ ^n
- Noise rate τ ∈ (0, 1/2)
- Samples y = As + e (mod 2) where each bit of e is 1 with probability τ
LPN is the binary variant of Learning With Errors (LWE). It’s considered quantum-resistant and has been studied extensively since the 1990s.
LPN in PVAC-HFHE
The scheme uses LPN with the following parameters (frominclude/pvac/core/types.hpp:58-61):
Security analysis
From the source code comments (include/pvac/core/types.hpp:53-56):
- Information-theoretic bound: 2226 bits
- Classical security: 200+ bits (exceeds 128-bit target)
- Quantum security: 100+ bits (exceeds NIST PQC requirements)
The scheme provides 128-bit security against both classical and quantum adversaries when using the default parameters.
PRF construction
LPN-based PRF
The scheme derives pseudorandom field elements using LPN:include/pvac/crypto/lpn.hpp:263-268:
PRF core algorithm
Frominclude/pvac/crypto/lpn.hpp:235-261:
- Generate
lpn_t = 16384LPN samples using AES-CTR mode - Derive Toeplitz matrix randomness (domain-separated)
- Apply Toeplitz hashing to extract 127 bits
- Map to a nonzero field element
LPN sample generation
Frominclude/pvac/crypto/lpn.hpp:194-233:
Domain separation
The scheme uses domain separation to ensure different PRF calls are independent: Frominclude/pvac/core/types.hpp:14-31:
Hypergraph matrix H
The public key includes a random binary matrix H of sizem_bits × n_bits:
Parameters (from include/pvac/core/types.hpp:42-45):
- Dimensions: 8192 × 16384 bits (16 MB dense, or ~200 KB sparse representation)
- Column weight: Each column has exactly 192 ones
- Random generation: Using cryptographically secure PRG
Syndrome computation
Each edge has a syndrome vector:- s ∈ ^8192 is the syndrome (stored in ciphertext)
- x ∈ ^16384 has Hamming weight 128 (kept secret)
- H is the public matrix
Key generation security
Frominclude/pvac/crypto/keygen.hpp:35-136:
Secret key generation
Multiplicative group generator
The scheme finds a generator g of the subgroup of order B = 337:B | (p-1), ensuring the subgroup exists.
Root of unity
Finds a primitive B-th root of unity ω_B:The root of unity enables efficient polynomial operations and is used in advanced features like recryption.
Constant-time operations
To prevent timing side-channels, key operations are constant-time:Constant-time field inversion
Frominclude/pvac/core/field.hpp:229-269, the fp_inv_ct function uses windowed exponentiation with:
- Fixed-time table lookups
- No data-dependent branches
- Constant number of field multiplications
Constant-time equality test
include/pvac/core/ct_safe.hpp (implied).
No branches: Uses bitwise operations only.
Security assumptions
Primary assumption
LPN Hardness: Given (A, y = As + e) with noise rate τ = 1/8, it is computationally infeasible to recover s in time less than 2^128.Supporting assumptions
- AES-256 in CTR mode is a secure PRG
- SHA-256 is collision-resistant (for key derivation)
- Random oracle model for Toeplitz hashing
Known attacks
Best known attacks on LPN(n=4096, t=16384, τ=1/8):All known attacks exceed the 128-bit security target by a significant margin.
Threat model
Honest-but-curious server
The server:- Can: Perform homomorphic operations on ciphertexts
- Cannot: Decrypt ciphertexts without the secret key
- Cannot: Learn anything about plaintexts beyond what’s leaked by operation patterns
What is NOT protected
Side-channel resistance
The implementation includes:- Constant-time field inversion
- Constant-time comparisons
- No secret-dependent memory accesses in critical paths
- Timing variations may leak information about ciphertext sizes
- Cache timing attacks are not fully mitigated
- Power analysis countermeasures are not implemented
For production use, additional hardening against side-channels would be required.
Security best practices
Key management
Seed generation
Parameter selection
Comparison with other assumptions
LPN is closely related to LWE but over binary fields. It’s considered quantum-resistant and has been studied extensively in coding theory and cryptography.
Next steps
Getting started
Build your first encrypted application
API reference
Explore the complete API